#!/usr/bin/env python


import gtaskengine
import tasklist
import getpass

class UI(object):
    def __init__(self):
        # All sort of window initialization
        pass
    
    def run(self):
        username = raw_input("Google Username (like johndoe@gmail.com): ")
        password = getpass.getpass()
        self.gEng = gtaskengine.GoogleTaskEngine(username, password)
        self.gEng.login()
        self.gEng.downloadTaskList()
        self.gEng.tasklist.doCommand()
        ans = raw_input("Save to google [y,N]: ")
        if ans == 'y' or ans == 'Y':
            self.gEng.uploadTaskList()
            print "List was saved\nBye."
        else:
            print "List was NOT saved!\nBye."

if __name__ == '__main__':
    ui = UI()
    ui.run()

